package com.oocl.servlet;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.oocl.exception.MyException;
import com.oocl.pojo.Food;
import com.oocl.service.impl.FoodServiceImpl;

/**
 * Servlet implementation class ToUpdateFood
 */
public class ToUpdateFoodServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;
       

    public ToUpdateFoodServlet() {
        super();
    }


	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		String fid=request.getParameter("fid");
		FoodServiceImpl fsi=new FoodServiceImpl();
		Food food=null;
		try {
			food=fsi.loadOne(fid);
			request.setAttribute("f", food);
		    request.getRequestDispatcher("updatefood.jsp").forward(request, response);   //补充跳转路径
		} catch (MyException e) {
			throw e;
		}
	}

	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		doGet(request, response);
	}

}
